<?php $this->layout( 'layout', [
	'body_class' => 'video-page',
	'info' => $info,
	'config' => $config,
] ) ?>

<?php if ( ! $error ) : ?>

<?php
if ( count( $info['formats'] ) ) :
	$player_format = $info['formats'][0];
	if ( ! $player_format['is_audio_only'] ) : // Video player
	?>
	<div class="player-container">
		<video width="<?=$player_format['width']?>" height="<?=$player_format['height']?>" controls="controls">
		<source src="<?=$player_format['url']?>" type="<?=$player_format['mimetype_type']?>">
		Your browser does not support the video tag. Please use a modern browser.
		</video>
	</div>
	<?php
	endif;
endif;
?>

<div id="test" class="video-key-info section">
	<h2><?=$this->e( $info['title'] )?></h2>
    <div class="view-count"><?=$this->e( $info['views'] )?> Views</div>
    <div class="channel-profile"><a class="channel-name" href="<?=$this->e( $info['channel_url'] )?>"><?=$this->e( $info['author'] )?></a></div>
    <div class="post-time"><?=$this->e( $info['publish_date_friendly'] )?></div>
</div>

<p class="short-description section"><?=nl2br( $info['short_description'] )?></p>

<details class="video-details section">
	<summary>Video Details</summary>
	<p>Views: <?=$this->e( $info['views'] )?></p>
	<p>Keywords: <?php echo $this->e( implode( $info['keywords'], ', ' ) ); ?></p>
	<p>Channel ID: <?php echo $this->e( $info['channelId'] ); ?></p>
	<p>Average Rating: <?=$this->e( $info['averageRating'] )?></p>
	<p>Unlisted? <?php echo ( $info['isUnlisted'] ) ? 'Yes' : 'No'; ?></p>
	<p>Category: <?=$this->e( $info['category'] )?></p>
	<p>Published: <?=$this->e( $info['publish_date_friendly'] )?> (<?=$this->e( $info['publish_date'] )?>)</p>
	<p>Formats available: <?php echo $this->e( count( $info['formats'] ) ); ?></p>
</details>

<?php else : ?>

<div class="error msg">Error: <?=$this->e($error)?></div>

<?php endif; ?>
